<div class="cms-form-message">
    Complete the form below to update the quick link information&nbsp;
</div>
<form action="<?php echo $this->url(array('action' => 'edit')); ?>" method="post" name="form3" id="form3">
    <table width="90%" align="center" cellpadding="6" cellspacing="0">
        <tr valign="baseline">
            <td width="21%" align="right" nowrap="nowrap"><strong>Link Category:</strong></td>
            <td colspan="3">
                <select id="LinkCategory" name="LinkCategory"><?php 
                    
                    for($i = 0; $i < count($categories); $i++) {
                        $id = $categories[$i]->getCategoryId();
                        $catName = $categories[$i]->getCategoryName();
                        $selected = $link->getCategory()->getId() == $id ? "selected='selected'" : "";
                        
                        echo "<option value='$id' $selected>$catName</option>";
                    }
                ?>
                </select>
            </td>
        </tr>
        <tr> </tr>
        <tr valign="baseline">
            <td nowrap="nowrap" align="right"><strong>Quick Link Name:</strong></td>
            <td colspan="3">
                <input type="text" name="LinkName" value="<?php echo htmlentities($link->getName(), ENT_COMPAT, 'iso-8859-1'); ?>" size="40" />
            </td>
        </tr>
        <tr valign="baseline">
            <td nowrap="nowrap" align="right" valign="top"><strong>Description:</strong></td>
            <td colspan="3">
                <textarea name="LinkDesc" cols="40" rows="3"><?php echo htmlentities($link->getDescription(), ENT_COMPAT, 'iso-8859-1'); ?></textarea>
            </td>
        </tr>
        <tr valign="baseline">
            <td nowrap="nowrap" align="right"><strong>Link URL:</strong></td>
            <td colspan="3">
                <input class="page-linker" type="text" id="LinkURL" name="LinkURL" value="<?php echo htmlentities($link->getData('LinkURL'), ENT_COMPAT, 'iso-8859-1'); ?>" size="45" />
            </td>
        </tr>
        <tr >
            <td nowrap="nowrap" align="right"><strong>Target:</strong></td>
            <td width="31%">
                <select name="LinkTarget" id="LinkTarget">
                    <option value="_self" <?php if (!(strcmp('_self', htmlentities($link->getTarget(), ENT_COMPAT, 'iso-8859-1')))) {echo "SELECTED";} ?>>Open In Same Window/Tab</option>
                    <option value="_blank" <?php if (!(strcmp('_blank', htmlentities($link->getTarget(), ENT_COMPAT, 'iso-8859-1')))) {echo "SELECTED";} ?> >Open In New Window/Tab</option>
                </select>
            </td>
            <td width="11%" align="right" nowrap="nowrap"><strong>Position:</strong></td>
            <td width="37%">
                <input name="LinkPosition" type="text" id="LinkPosition" value="<?php echo $link->getPosition(); ?>" size="4" style="text-align:center" />
            </td>
        </tr>
        <tr valign="baseline">
            <td nowrap="nowrap" align="right"><strong>Published:</strong></td>
            <td colspan="3">
                <input <?php if (!($link->isPublished())) {echo "checked=\"checked\"";} ?> name="Published" type="checkbox" id="Published" value="true" />
            </td>
        </tr>
        <tr valign="baseline">
            <td nowrap="nowrap" align="right">&nbsp;</td>
            <td colspan="3">&nbsp;</td>
        </tr>
        <tr valign="baseline">
            <td nowrap="nowrap" align="right">&nbsp;</td>
            <td colspan="3">
                <input type="submit" value="Save Changes" />
                <input type="button" name="Cancel3" id="Cancel3" value="Cancel" onclick="window.location.href = '<?php echo $this->url(array('action' => 'index')); ?>'" />
            </td>
        </tr>
    </table>
    <input type="hidden" name="MM_update" value="form3" />
    <input type="hidden" name="id" value="<?php echo $link->getId(); ?>" />
</form>